<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Js.base.create and Js.base.extend</title>
		<script type="text/javascript" src="../lib/jquery/jquery.js"></script>
		<script type="text/javascript" src="../lib/savvyui.js"></script>
	</head>
	<body>
		<h1>Js.base.create and Js.base.extend</h1>
		<div id="result">
			<h2>Result</h2>
		</div>
		
		<script type="text/javascript">
		<!--
		
		var Person = new Js.create({
			name: null,
			initiate: function(name) {
				this.name = name;
			}
		});
		var Student = Person.extend({
			initiate: function(name, age) {
				var setName = function(name) {
					this.name = name;
				};
				
				setName.call(this, name);
				
				this.age = age;
				
				this.getName = function() {
					return this.name + ": " + this.age;
				};
			}
		});
		var me = new Student("Andrea", 30);
		console.log(me.getName());
		
		var Icon = Js.create({
			_value: 0,
			initiate: function() {
				var _value = 5;
				this.print = function() {
					console.log("private _value", _value);
	   				console.log("public _value", this._value);
				};
			}
			
		});
		
		var icon = new Icon;
		icon.print();
		icon._value=13;
		icon.print();
		icon.$inject(function() {
			this._value = 25;
		});
		icon.print();
		
		var nescafe = new Js.create;
		nescafe.prototype.say = function() {
			console.log("hello world");
		};
		nes = nescafe.extend({
			say: function() {
				this.$parent('say');
				console.log("hello world again");
			}
		});
		
		var original = new nes;
		original.say();
		-->
		</script>
		
	</body>
</html>